package at.ac.tuwien.dse.health.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;

import java.io.Serializable;
import java.math.BigInteger;

/**
 * Hospital with geographic information
 *
 * @author Bernhard Nickel
 * @author Gregor Schauer
 * @author Dominik Strasser
 */
public class GeoHospital implements Serializable {
	@Id
	private BigInteger id;
	private String name;
	@Indexed
	private double[] location;

	private GeoHospital() {
	}

	public GeoHospital(BigInteger id, String name, double[] location) {
		this.id = id;
		this.name = name;
		this.location = location;
	}

	public BigInteger getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public double[] getLocation() {
		return location;
	}

	@Override
	public String toString() {
		return name;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		GeoHospital that = (GeoHospital) o;
		return id.equals(that.id);

	}

	@Override
	public int hashCode() {
		return id.hashCode();
	}
}
